GBML manual / Save

save_has

True if key has ever been saved (and not since cleared).

Syntax

save_has(key) -> bool

Arguments

NameType
keystring

Returns

bool

Description

True if key has ever been saved and not since cleared. Useful to tell "never set" apart from "set to a value that happens to equal your fallback" - a case save_get alone cannot distinguish, since it returns the same fallback either way.

Example

if (save_has("high_score")) {
    var best = save_get("high_score", 0);
}

Only reads the value if it was actually ever saved - useful when "never saved" needs different handling than "saved as 0."

See also: save_get